/*
 * @Author: zhouwr 1551541860@qq.com
 * @Date: 2024-02-17 16:42:50
 * @LastEditors: zhouwr 1551541860@qq.com
 * @LastEditTime: 2024-02-22 00:01:31
 * @FilePath: /jeecg-boot-master/jeecg-module-activiti/jeecg-module-activiti-biz/src/main/java/org/jeecg/modules/service/IActProcessDefService.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package org.jeecg.modules.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.activiti.engine.repository.Model;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.batik.transcoder.TranscoderException;
import org.jeecg.modules.dto.ActProcessDef;
import org.jeecg.modules.dto.OutProcessDefElementDto;
import org.jeecg.modules.entity.ActProcdefBusinessEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @Description: 流程部署
 * @Author: jeecg-boot
 * @Date: 2023-12-06
 * @Version: V1.0
 */
public interface IActProcessDefService {

  IPage<ActProcessDef> listPage(ActProcessDef actProcessDef, Integer pageNo, Integer pageSize);

  List<ActProcessDef> list(ActProcessDef actProcessDef);

  List<ActProcessDef> listHistory(String procDefKey);

  Page<ProcessInstance> runningListPage(String procInsId, String procDefKey, Integer pageNo, Integer pageSize);

  List<OutProcessDefElementDto> listFlowElement(String procDefId);

  InputStream resourceRead(String procDefId, String proInsId, String resType) throws Exception;

  InputStream getFlowchart(String procDefId) throws Exception;

  // ActProcdefBusinessEntity findById(@Valid Long id) throws Exception;

  ActProcdefBusinessEntity findByProcdefId(@Valid String procdefId) throws Exception;

  int saveProcdefBusiness(@Valid ActProcdefBusinessEntity business) throws Exception;

  int updateProcdefBusiness(@Valid ActProcdefBusinessEntity business) throws Exception;

  @Transactional(readOnly = false)
  String deploy(String category, MultipartFile file);

  @Transactional(readOnly = false)
  String updateState(String procDefId, String state);

  @Transactional(readOnly = false)
  Model convertToModel(String procDefId) throws IOException, XMLStreamException, TranscoderException;

  void deleteByDeployId(String id);

}
